import 'package:easy_read_comic/view/me/login_view.dart';
import 'package:easy_read_comic/view/me/register_view.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

class LoginWithRegisterView extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _LoginView();
}

class _LoginView extends State<LoginWithRegisterView>
    with SingleTickerProviderStateMixin {
  late TabController _tabController;

  @override
  void initState() {
    super.initState();
    _tabController = TabController(length: 2, vsync: this);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).primaryColor,
      ),
      resizeToAvoidBottomInset: false,
      body: Container(
        child: Column(
          children: [
            Container(
              decoration: BoxDecoration(
                color: Theme.of(context).primaryColor,
              ),
              height: 200,
              width: Get.width,
              alignment: Alignment.center,
              child: Text(
                "易漫网",
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 50,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),
            Container(
              child: TabBar(
                tabs: [
                  Tab(
                    text: "登录",
                  ),
                  Tab(
                    text: "注册",
                  ),
                ],
                controller: _tabController,
              ),
            ),
            Expanded(
              child: Container(
                child: TabBarView(
                  children: [
                    LoginView(),
                    RegisterView(_tabController),
                  ],
                  controller: _tabController,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
